<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>工程列表页</title>
</head>
<body>
<h1>Project</h1>
<div th:each="m:${project}">
    <a th:href="${m.pid}" th:text="${m.name}"></a>
</div>

<div class="showPage">
    <a th:each="h:${projectHref}"  th:text="${h}" class="pageHref"></a>
</div>

<script th:inline="javascript">
    var params = {
        sid: [[${sid}]]
    }
    console.log(params);
</script>

<script th:inline="javascript">
    var pageHref = document.getElementsByClassName('pageHref');
    var pageCounter = [[${pageCounter}]];
    var prior = [[${prior}]];
    var next = [[${next}]];
    var showPage = document.getElementsByClassName('showPage');
    var size = [[${size}]];
</script>

<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    for(var i=0;pageCounter>0;pageCounter--,i++){   //直接用i于pageCounter相减有bug,不明原因
        console.log(pageCounter)
        var href = "index?start="+ (i*size) + "&size=" + size;
        pageHref[i].setAttribute("href",href);
    }
    /*]]>*/
</script>

</body>
</html>